<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        /**
         * 分析：
         *      点击超链接或图片，更换图片
         *      1.给超链接和图片绑定单机事件
         *      2.重新设置图片的src属性值
         */
        window.onload = function () {
            //1.获取图片对象
            var img = document.getElementById("CheckCode");
            img.onclick = function () {
                //加时间戳
                var date = new Date().getTime();
                img.src = "/Vc_demo1?"+date;
            }
            var change = document.getElementById("Change")
            change.onclick = function () {
                var date = new Date().getTime();
                img.src = "/Vc_demo1?"+date;
            }
        }
    </script>
</head>
<body>
    <form action="/"method="post">
        用户名<input name="username" type="text"><br>
        密码<input name="password" type="password"><br>
        验证码<input  type="text"><br>
        <img id="CheckCode" src="/Vc_demo1">
        <a id="Change" href="">看不清换一张？</a><br>
        <input type="submit" value="注册">
    </form>
</body>
</html>